package thread;
import sun.java2d.loops.GraphicsPrimitive;

import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

import static print.Print.*;
class ADaemon implements Runnable{
    @Override
    public void run() {
        try{
            print("Starting ADaemon");
            TimeUnit.SECONDS.sleep(1);
        }catch (InterruptedException ex){
            print("Exiting via InterruptedException");
        }
        finally {
            print("this should always run?");
        }
    }
}
public class DaemonsDontRunFinally {
    public static void main(String[] args) throws Exception{
        Thread thread = new Thread(new ADaemon());
        thread.setDaemon(true);
        thread.start();
        TimeUnit.MILLISECONDS.sleep(200);
    }
}
